package com.seveneight.baijiesteward.ui.user.model;

import android.content.Context;
import android.util.Log;

import com.seveneight.baijiesteward.bean.BaseEntity;
import com.seveneight.baijiesteward.bean.UserBean;
import com.seveneight.baijiesteward.http.BaseModel;
import com.seveneight.baijiesteward.http.BaseObserver;
import com.seveneight.baijiesteward.http.MyCallBack;
import com.seveneight.baijiesteward.http.RetrofitFactory;
import com.seveneight.baijiesteward.ui.user.contract.IdentifyContract;
import com.seveneight.baijiesteward.utils.UploadUtil;

import okhttp3.RequestBody;

/**
 * Created by user1 on 2018/2/24.
 */

public class IdentifyModel extends BaseModel implements IdentifyContract.IdentifyModel {


    @Override
    public void UploadImg(Context context, RequestBody body, MyCallBack<String> callBack) {

    }

    @Override
    public void startIdentify(Context context,RequestBody body, MyCallBack<UserBean> callBack) {
        RetrofitFactory.getInstence().API()
                .startIdentify(body).compose(this.<BaseEntity<UserBean>>setThread())
                .subscribe(new BaseObserver<UserBean>(context) {
                    @Override
                    protected void onSuccees(BaseEntity<UserBean> t) throws Exception {
                        Log.d("identify:", t.toString());
                        callBack.onSuccess(t.getData());
                    }

                    @Override
                    protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {

                    }
                });


    }
}
